<extend name="Public/base"/>

<block name="body">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query += 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

    $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });

    $('#datetimepicker').datetimepicker({
       format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true,
        pickerPosition:'bottom-left'
    })
    
})
</script>
	<div class="main-title">
		<h2>返佣明细</h2>
	</div>
<!-- 
	<div class="cf">
		<div class="search-form fr cf">
			<div class="sleft">
				<input type="text" name="login_user" class="search-input" value="{:I('login_user')}" placeholder="请输入用户名">
				<input type="text" name="order_sn" class="search-input" value="{:I('order_sn')}" placeholder="请输入订单号">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('BrokerageRecord/index')}"><i class="btn-search"></i></a>
			</div>
			
            <div class="btn-group-click adv-sch-pannel fl">
                <button class="btn">高 级<i class="btn-arrowdown"></i></button>
                <div class="dropdown cf">
                	<div class="row">
                		<label>返佣时间：</label>
                		<input type="text" id="time-start" name="start_date" class="text input-2x" value="" placeholder="起始时间" /> -                		
                        <div class="input-append date" id="datetimepicker"  style="display:inline-block">
                            <input type="text" id="time-end" name="end_date" class="text input-2x" value="" placeholder="结束时间" />
                            <span class="add-on"><i class="icon-th"></i></span>
                        </div>
                	</div>
                </div>
            </div>
		</div>
	</div>
 -->
	<div class="data-table table-striped">
		<table>
			<thead>
				<tr>
					<th class="row-selected">
						<input class="checkbox check-all" type="checkbox">
					</th>
					<th>ID</th>
					<th>订单号</th>
					<th>用户</th>
					<th>佣金</th>
                    <th>返佣日期</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="item">
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="ids[]" id="" value="{$item['id']}"> </td>
						<td>{$item.id}</td>
						<td>
						<if condition="$item['order_type'] eq 1">
						<a href="{:U('Order/views',array('id'=>$item['order_id']))}">{$item.order_sn}</a>
						<else/>
						<a href="{:U('Spell/views',array('id'=>$item['order_id']))}">{$item.order_sn}</a>
						</if>
						</td>
						<td><a href='{:U('Member/edit',array('id'=>$item['parent_id']))}'>{:getuserattr($item['parent_id'])}</a></td>
                        <td>{$item['money']}</td>
                        <td>{:date("Y-m-d",$item['addtime'])}</td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
	</div>
		<div class="page">
        {$page}
		</div>
</block>

<block name="script">
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('BrokerageRecord/index')}");
    $(function() {
    	//点击排序
    	$('.list_sort').click(function(){
    		var url = $(this).attr('url');
    		var ids = $('.ids:checked');
    		var param = '';
    		if(ids.length > 0){
    			var str = new Array();
    			ids.each(function(){
    				str.push($(this).val());
    			});
    			param = str.join(',');
    		}

    		if(url != undefined && url != ''){
    			window.location.href = url + '/ids/' + param;
    		}
    	});
    });
</script>
</block>